<!--
 * @Description: 
 * @Author: rendc
 * @Date: 2025-09-15 14:28:44
 * @LastEditors: rendc
 * @LastEditTime: 2025-09-15 14:47:25
-->
<!DOCTYPE html>
<html lang="en">    
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>清除浮动</title>
    <style>
    body {/* 取消默认的 margin 和 padding 
        %相对于父元素的高度或者宽度*/
        margin: 0;
        padding: 0;
        border: 1px solid rgb(0, 229, 255);
        height: 100vh;
    }
.up,.down,.midddle{
    border: 1px solid rgb(0, 234, 4);
}
.up,.down{
    height: 10%;
    /* background-color: yellow; */
}
.midddle{
    height: 80%;
    
}
.midddle_left,.midddle_right{
    border: 1px solid rgb(255, 0, 0);
    height: 50%;
    width: 50%;
    
}
.midddle_left{
    float: left;
    /* width: 50%; */
    /* background-color: red; */
}
.midddle_right{
    float: right;
    /* width: 50%; */
    /* background-color: blue; */
}
</style></head>
<body>
    <div class="up">
        上部分
    </div>
    <div class="midddle">
        <div class="midddle_left" style="float: left; width: 50%; background-color: red;">
            左边
        </div>
        <div class="midddle_right" style="float: right; width: 50%; background-color: blue;">
            右边
        </div>
        <div style="clear: both;"></div>
    </div>
    <div class="down">
        下部分
    </div>
</body>
</html>